package biz.impl;

import java.util.List;

import biz.OrderStateBiz;
import dao.OrderDao;
import dao.OrderStateDao;
import dao.impl.OrderDaoImpl;
import dao.impl.OrderStateDaoImpl;
import entity.OrderState;

public class OrderStateBizImpl implements OrderStateBiz {
	private OrderStateDao orderStateDao = new OrderStateDaoImpl();
	private OrderDao orderDao = new OrderDaoImpl();
	@Override
	public List<OrderState> queryAllOrderState() {
		List<OrderState> orderStateList = orderStateDao.queryAllOrderState();
		for (OrderState orderState : orderStateList) {
			orderState.setOrderList(orderDao.queryOrderByOrderStateId(orderState.getOrderStateId()));
		}
		return orderStateList;
	}

	@Override
	public OrderState queryOrderStateById(int orderStateId) {
		OrderState orderState = orderStateDao.queryOrderStateById(orderStateId);
		orderState.setOrderList(orderDao.queryOrderByOrderStateId(orderStateId));
		return orderState;
	}
}
